<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var obj = {
            id: 11,
            name: '张三',
            age: 12,
        }
        var arr = []
        for (let key in obj) {
            arr.push([key, obj[key]])
        }
        // console.log(arr);
        var ccc = []

        arr.forEach(function (value) {
            ccc.push(value.join(':'))
        })
        // console.log(ccc);
        var nnn = ccc.join('&')
        // console.log(nnn);
        // 字符串转换为对象
        // console.log(nnn.split('&'))
        var aaa = nnn.split('&')
        var bbb = []
        var fff = {}
        // console.log(aaa);
        aaa.forEach(function (value, index) {
            bbb.push(value.split(':'))
        })
        console.log(bbb);
        console.log(...aaa);
        bbb.forEach(function (item, index) {
            // console.log(item);
            // console.log(item[0]);
            fff[item[0]] = item[1]
            // console.log(fff);
        })
        console.log(fff);
    </script>
</body>

</html>